fix: detect job attachments independent of dynamic model build order#902
fix: detect job attachments independent of dynamic model build order#902radu-mocanu wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes unreliable detection of “job attachment” fields in dynamically generated Pydantic models by removing dependence on the shared dynamic module’s last-written type object. Instead, each generated attachment class now carries a stable per-class marker used during JSONPath discovery, making detection independent of dynamic model build order.
Changes:
- Add a per-class marker (
__uipath_marker_name__) to dynamically generated BaseModel classes during schema-to-model conversion. - Update type-matching logic to prefer the per-class marker over module identity when detecting referenced types.
- Add a regression test ensuring attachment detection remains correct after building a second dynamic model.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/uipath_langchain/agent/react/jsonschema_pydantic_converter.py |
Sets a stable per-class marker on each generated dynamic BaseModel to avoid build-order-dependent identity issues. |
src/uipath_langchain/agent/react/json_utils.py |
Updates type matching to prefer the new per-class marker, keeping detection stable across multiple dynamic schema builds. |
tests/agent/react/test_json_utils.py |
Adds a regression test covering build-order independence for attachment detection. |
pyproject.toml |
Bumps project version to 0.11.17. |
uv.lock |
Updates locked package version to match 0.11.17. |
b23c600 to
9b875cb
Compare
9b875cb to
b91fe74
Compare
|
|
Could we add one regression through get_job_attachments as well, not only get_json_paths_by_type? That would prove the user-facing attachment extraction still works after another dynamic model with the same JobAttachment definition is built? |



Summary
Why
attachment detection compared field types by object identity against a single process-wide module attribute. each schema build registered its own attachment class under that attribute, so the most recent build won and detection on every other schema silently returned nothing.